<template>
  <div>
      <span>计算值：{{count}}</span>
      <button @click="increat">加</button>
      <button @click="deIncreat">减</button>
  </div>
</template>

<script>
import {ref} from "vue"
export default {
    setup() {
        let count = ref(0)
        const increat = ()=>{
            count.value += 1
        };
        const deIncreat =()=> {
            if (count.value>0) {
                count.value -= 1
            }else {
                alert("不能再减了！！！")
            }
        }

        return {
            count,
            increat,
            deIncreat
        }
    }
}
</script>

<style>

</style>